<html>
    <head>
        <meta charset="UTF-8">
        <title></title>
        <style type="text/css">
        </style>
        <link href="public/css/cssindex3.css" rel="stylesheet" type="text/css" />
    </head>
    <body>
<?php
                    require_once './model/dbdemo.php';
                    require_once './model/workdemo.php';
                    require_once './model/paginationdemo.php';
//        require_once './model/keywords.php';
//        $keys = new Keywords();
//        $key = $keys->maxlength();
                    $works = new Works();
                    $paginations=new Pagination();
                    ?>      
                    <?php
                    if (!isset($_GET["page"]))
                        $page = 1;
                    else
                        $page = $_GET["page"];
                    $list = $works->select($page);
                    $total = $works->countWords();
                    echo $paginations->Display($page, $total,null,"test.php");
                    ?>
<br>                   
                    <table border="1px" align="center">
                        <tr class="works">
                            <td><b>STT</b></td>
                            <td><b>name</b></td>
                            <td><b>description</b></td>
                            <td><b>posted</b></td>
                        </tr>
                        <?php foreach ($list as $item): ?>
                            <tr>
                                <td class="echo"><?php echo$item['id']; ?></td>
                                <td class="bgtable"><a href="<?php echo$item['url']; ?>" style="text-decoration: none">
                                    <?php echo$item['name']; ?></a></td>                                            
                                <td class="bgtable"><?php echo substr($item['description'],0,100); ?></td>
                                <td class="echo"><?php $mydate = getdate($item['posted']); ?> 
                                    <?php echo "$mydate[mday] $mydate[month], $mydate[year]"; ?></td>
                            <?php endforeach; ?>
                        </tr>
                    </table>
                    <br>
                    <?php echo $paginations->Display($page, $total,null,"test.php");?>
                    <br>
    </body>
</html>
  